#include <reg167.h>
#include "../lib/capture1.h"

void InitCapture1(int capture1_ilvl,int capture1_glvl)
{
	DPP2 &= 0x7E7F; // Bits 8 et 9 du port 2 comme input (0)
	CCM2 = 0xB; //Capture on Positive and Negative Transition (Both Edges) at Pin CC1IO; CC1 allocated to Timer T1
	CC8IC = (CC1IC & 0xFFFC)|((capture1_ilvl & 0x3F)<<2)|(capture1_glvl & 0x3); // configure GLVL et ILVL sur CC1IC
	CC8IE = 1; // Active les interruptions du module Compare 1
}	